package com.etc.util;

import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Calendar;

import java.util.Date;
import java.util.HashMap;
@Component
public class DateUtil {

    public HashMap getDate() {
        HashMap hashMap = new HashMap();

        SimpleDateFormat sdf = new SimpleDateFormat("MM月dd日");
        Calendar c = Calendar.getInstance();
        c.add(Calendar.DATE, 0);//-1.昨天时间 0.当前时间 1.明天时间 *以此类推
        String today = sdf.format(c.getTime());
        c.add(Calendar.DATE, 1);//-1.昨天时间 0.当前时间 1.明天时间 *以此类推
        String tomorrow = sdf.format(c.getTime());
        c.add(Calendar.DATE, 1);//-1.昨天时间 0.当前时间 1.明天时间 *以此类推
        String afterTomorrow = sdf.format(c.getTime());
        hashMap.put("today",today);
        hashMap.put("tomorrow",tomorrow);
        hashMap.put("afterTomorrow",afterTomorrow);

        return hashMap;
    }
    public boolean decideDate(Date useDate){
        Date nowDate=new Date();
        return nowDate.before(useDate);
    }
}
